<script>
import Store from '@/stores/vuex'

export default {
	onLaunch() {
		console.log('App Launch')
		console.log(process.env.UNI_PLATFORM)
		this.setMpWxPos()
	},
	onShow: function () {
		console.log('App Show')
	},
	onHide: function () {
		console.log('App Hide')
	},
	methods: {
		setMpWxPos() {
			// console.log('setMpWxPos')
			// 微信位置数据
			const mpWxPos = this.$store.getters['mpWxPos/getMpWxPos']
			const systemInfo = uni.getSystemInfoSync()
			// console.log('systemInfo', systemInfo)
			mpWxPos.statusBarHeight = systemInfo.statusBarHeight
			mpWxPos.menuButton = uni.getMenuButtonBoundingClientRect()
			const navBarHeight = systemInfo.platform === 'android' ? 48 : 44 // 默认导航栏高度（不含状态栏）
			mpWxPos.navBarHeight = navBarHeight
			mpWxPos.headerHeight = navBarHeight + mpWxPos.statusBarHeight
			// mpWxPos.menuButtonBottomGap = systemInfo.platform === 'android'? 8 : 0 // 默认底部间距
			mpWxPos.menuButtonBottomGap = mpWxPos.headerHeight - mpWxPos.menuButton.bottom
			mpWxPos.screenTop = systemInfo.screenTop
			mpWxPos.screenHeight = systemInfo.screenHeight
			mpWxPos.screenWidth = systemInfo.screenWidth
			mpWxPos.windowHeight = systemInfo.windowHeight
			mpWxPos.windowWidth = systemInfo.windowWidth
			mpWxPos.windowTop = systemInfo.windowTop
			mpWxPos.windowBottom = systemInfo.windowBottom
			mpWxPos.safeArea = systemInfo.safeArea
			mpWxPos.safeAreaInsets = systemInfo.safeAreaInsets
			mpWxPos.logoLeft = systemInfo.safeArea.width - mpWxPos.menuButton.right
			mpWxPos.logoHeight = mpWxPos.navBarHeight - mpWxPos.menuButtonBottomGap
			// mpWxPos.logoUrl = this.$api.gdImg(200, mpWxPos.logoHeight)
			// mpWxPos.logoUrl = this.$api.baseUrl + '/static/images/yaya.logo.png'
			mpWxPos.logoUrl = this.$api.baseUrl + '/static/images/YaYaLogo.png'
			// console.log('mpWxPos', mpWxPos)
			this.$store.commit('mpWxPos/updateMpWxPos', mpWxPos)
		}
	}
}
</script>

<style lang="scss">
/*每个页面公共css */
@import 'uview-plus/index.scss';
</style>
